
package sharedServlets;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;

import sessionMenegment.SessionMgr;

import controller.Controller;

@SuppressWarnings("serial")
public class RedirectClientBiz extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		SessionMgr sessionMgr = SessionMgr.getInst();
		HttpSession session = req.getSession();
		boolean flag = sessionMgr.checkUser(req, session);
		if(!flag){
			session.setAttribute("error", "Please login before entering the Terminal");
			resp.sendRedirect("home.jsp");
		}
		else{
			String userName = (String)session.getAttribute("userNameBusiness");
			if(userName!=null)
				resp.sendRedirect("/business/allOrders.jsp");
			else
				resp.sendRedirect("/allClientOrders.jsp");
		}
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
				

	}
	
}
